package com.motu.monstercity.server.game.logic;

import com.motu.monstercity.server.game.userdata.UserFlorist;
import com.motu.monstercity.server.game.userdata.UserFloristTask;
import com.motu.vertx.module.utility.model.EntityManager;
import com.motu.vertx.module.utility.model.Model;

import java.util.ArrayList;
import java.util.List;

public class FloristUserData extends FloristBaseData {
    public static UserFlorist getUserFlorist(long userId) {
        return (UserFlorist) EntityManager.getUniqueEntity(UserFlorist.class, userId);
    }

    public static List<UserFloristTask> getUserFloristTaskList(long userId) {
        List<Model> modelList = EntityManager.getEntityList(UserFloristTask.class, userId);
        List<UserFloristTask> taskList = new ArrayList<>();
        for (Model model : modelList) {
            UserFloristTask userFloristTask = (UserFloristTask) model;
            taskList.add(userFloristTask);
        }
        return taskList;
    }

    public static UserFloristTask getUserFloristTask(long userId, int taskId) {
        return (UserFloristTask) EntityManager.getEntity(UserFloristTask.class, userId, taskId);
    }
}
